package cn.hznc.controller.uploadfilestrategy;

import cn.hutool.core.util.ObjectUtil;

/**
 * @Author：Administrator
 * @Date：2024/2/28 16:33
 */
public class RemoveFileContext{

    private RemoveFileStrategy removeFileStrategy;

    public RemoveFileContext(){

    }

    public RemoveFileContext(RemoveFileStrategy removeFileStrategy){
        this.removeFileStrategy = removeFileStrategy;
    }

    public void removeFileByStrategy(String filename , Integer flag){
        if(ObjectUtil.isNotNull(flag) && flag == 1){
            this.removeFileStrategy = new RemoveFileMinio();
            removeFileStrategy.removeFile(filename);
        } else if (ObjectUtil.isNotNull(flag) && flag == 2) {
            this.removeFileStrategy = new RemoveFileLocal();
            removeFileStrategy.removeFile(filename);
        }
    }


}
